import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.0

Rectangle {
    width: 200
    clip: true

    GridLayout {
        x: 0
        y: 0
        width: 200
        height: 104
        antialiasing: false
        rows: 3
        columns: 2

        Label{
            text: "Int :"
            Layout.fillHeight: true
            Layout.fillWidth: false
        }

        TextEdit {
            id: textEditMyInt
            width: 100
            height: 30
            text: ""
            Layout.fillWidth: true
            Layout.fillHeight: true
            font.pixelSize: 12
        }

        Label{
            text: "Doulble :"
            Layout.fillHeight: true
            Layout.fillWidth: false
        }

        TextEdit {
            id: textEditMyDouble
            width: 100
            text: ""
            Layout.fillHeight: true
            Layout.fillWidth: true
            font.pixelSize: 12
        }

        Label{
            text: "Opacity :"
            Layout.fillHeight: true
            Layout.fillWidth: false
        }

        TextEdit {
            id: textEditMyOpacity
            width: 100
            text: qsTr("1")
            Layout.fillHeight: true
            Layout.fillWidth: true
            font.pixelSize: 12
        }
    }

    // connect signal onCompleted
    Component.onCompleted: {
        myIterator.sigMyInt.connect(onMyIntChange)//void
        myIterator.sigMyDouble.connect(onMyDoubleChange) //void
        myIterator.sigMyOpacity.connect(onMyOpacityChange) // pass double value
    }

    // get value by myIterator
    function onMyIntChange(){
        console.log("function OnMyIntChange()")
        textEditMyInt.text = myIterator.MyInt;
    }

    // get value by myIterator
    function onMyDoubleChange(){
        console.log("function onMyDoubleChange()")
        textEditMyDouble.text = myIterator.MyDouble;
    }

    // get value by signal
    function onMyOpacityChange(iValue){
        console.log("function onMyOpacityChange(" + iValue + ")")
        textEditMyOpacity.text = iValue.toFixed(2);
    }
}

/*##^##
Designer {
    D{i:3;anchors_height:20;anchors_width:80}D{i:1;anchors_x:0;anchors_y:0}
}
##^##*/
